# 定义任务
from .yuntongxun.ccp_sms import CCP
from aijia.celery_tasks.main import celery_app
import logging

logger = logging.getLogger('django')

@celery_app.task(bind=True,name='ccp_send_sms_code',retry_backoff=3)
def ccp_send_sms_code(self,mobile,sms_code):
    try:
        CCP().sendTemplateSMS(mobile,[sms_code,5],1)
    except Exception as e:
        logger.error(e)
        raise self.retry(exc=e, max_retries=3)  # 如果发送短信失败，重新发送，最大发送次数为3